from selenium import webdriver
from time import sleep

driver = webdriver.Firefox()
driver.get('https://mail.163.com/')
sleep(2)

iframe = driver.find_element_by_xpath('/html/body/div[2]/div[3]/div/div[3]/div[4]/div[1]/div[1]/iframe')
driver.switch_to.frame(iframe)
driver.find_element_by_name('email').send_keys('syndicate0618')
driver.find_element_by_name('password').send_keys('zzm19990320')
driver.find_element_by_id('dologin').click()
sleep(2)
driver.switch_to.default_content()
driver.find_element_by_id('_mail_component_24_24').click()
driver.find_element_by_class_name('nui-editableAddr-ipt').send_keys('840182406@qq.com')
driver.find_element_by_class_name('nui-ipt-input').send_keys('化工学院_计173班_张紫陌  自动化发送邮件')
sleep(2)
iframe = driver.find_element_by_class_name('APP-editor-iframe')
driver.switch_to.frame(iframe)
Set = 'body > p:nth-child(1)'
driver.find_element_by_css_selector(Set).send_keys('吃葡萄不吐葡萄皮！！！')
sleep(2)
driver.switch_to.default_content()
driver.find_element_by_class_name('nui-ico-sent-white').click()
sleep(2)
driver.close()